<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="/assets/background/css/base.css" rel="stylesheet">
<%@ include file="../../commons/commons_resource_head.jsp"%>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script>
<title>Insert title here</title>
<style type="text/css">
#toolbar>input {
	display: inline;
}
</style>

</head>
<body>
<!--[if lte IE 7]>
<style type="text/css">
#errorie {position: fixed; top: 0; z-index: 100000; height: 30px; background: #FCF8E3;}
#errorie div {width: 900px; margin: 0 auto; line-height: 30px; color: orange; font-size: 14px; text-align: center;}
#errorie div a {color: #459f79;font-size: 14px;}
#errorie div a:hover {text-decoration: underline;}
</style>
<div id="errorie"><div>您还在使用老掉牙的IE，请升级您的浏览器到 IE8以上版本 <a target="_blank" href="http://windows.microsoft.com/zh-cn/internet-explorer/ie-8-worldwide-languages">点击升级</a>&nbsp;&nbsp;强烈建议您更改换浏览器：<a href="http://down.tech.sina.com.cn/content/40975.html" target="_blank">谷歌 Chrome</a></div></div>
<![endif]-->
    <div id="inner-hd">
            <div class="crumbs">
				<i class="crumbs-arrow"></i>
				<a href="javascript:;" class="crumbs-label">智能柜租赁</a>
			</div>
        </div>
	<div class="container-fluid">
 
		<div id="toolbar">
			<%-- <input type="text" class="form-control" style="width: 220px;" placeholder="请输入用户名、姓名、手机号" id="pf-search_user_key" value="${userName }"> --%>
			类型：<select class="form-control" style="display: inline-block; width: 150px" id="pf-search_user_status">
			  
			  <option value="1">售货柜</option>
			  <option value="2">寄存柜</option>
			</select>
			
			<button id="pf-search-btn" class="btn btn-primary btn-sm">
				<i class="glyphicon glyphicon-search"></i>
				查询
			</button>
	

		</div>
		<table class="table table-striped table-bordered table-hover table-full-width" id="pf-user-table" data-toolbar="#toolbar">
			<thead>

			</thead>
			<tbody>

			</tbody>
		</table>
	</div>
	<%@ include file="cabinet_edit.jsp"%>
	<%@ include file="../../commons/commons_resource_foot2.jsp"%>
	<script src="/assets/scripts/cabinet/cabinet_list.js"></script>
	<script type="text/javascript">
    var map = new BMap.Map("container");
    map.centerAndZoom("厦门", 14);
    map.enableScrollWheelZoom();    //启用滚轮放大缩小，默认禁用
    map.enableContinuousZoom();    //启用地图惯性拖拽，默认禁用

    map.addControl(new BMap.NavigationControl());  //添加默认缩放平移控件
    map.addControl(new BMap.OverviewMapControl()); //添加默认缩略地图控件
    map.addControl(new BMap.OverviewMapControl({ isOpen: true, anchor: BMAP_ANCHOR_BOTTOM_RIGHT }));   //右下角，打开

    map.addEventListener("click",function(e){

        map.clearOverlays();//清空原来的标注

        //alert(e.point.lng+","+e.point.lat);// 单击地图获取坐标点；
          $("#lng").val(e.point.lng);
          $("#lat").val(e.point.lat);
        map.panTo(new BMap.Point(e.point.lng,e.point.lat));// map.panTo方法，把点击的点设置为地图中心点
        var marker = new BMap.Marker(new BMap.Point(e.point.lng,e.point.lat));  // 创建标注，为要查询的地方对应的经纬度
        map.addOverlay(marker);

        var point = new BMap.Point(e.point.lng,e.point.lat);
        var gc = new BMap.Geocoder();
        gc.getLocation(point, function(rs) {
            var addComp = rs.addressComponents;
            $("#cProvince").val(addComp.province);
            $("#cCity").val(addComp.city);
            //$("#cArea").val(addComp.district+addComp.street+addComp.streetNumber);
           // alert(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street + ", " + addComp.streetNumber);
        });


    });

    var localSearch = new BMap.LocalSearch(map);
    localSearch.enableAutoViewport(); //允许自动调节窗体大小
    function searchByStationName() {
        map.clearOverlays();//清空原来的标注
        var keyword = $("#cProvince").val()+$("#cCity").val()+$("#cArea").val();
        localSearch.setSearchCompleteCallback(function (searchResult) {
            var poi = searchResult.getPoi(0);
            $("#lng").val(poi.point.lng);
            $("#lat").val(poi.point.lat);
            //document.getElementById("result_").value = poi.point.lng + "," + poi.point.lat;
            map.centerAndZoom(poi.point, 14);
            var marker = new BMap.Marker(new BMap.Point(poi.point.lng, poi.point.lat));  // 创建标注，为要查询的地方对应的经纬度
            map.addOverlay(marker);
            var content =  $("#cProvince").val()+$("#cCity").val()+$("#cArea").val()+ "<br/><br/>经度：" + poi.point.lng + "<br/>纬度：" + poi.point.lat;
            var infoWindow = new BMap.InfoWindow("<p style='font-size:14px;'>" + content + "</p>");
            marker.addEventListener("click", function () { this.openInfoWindow(infoWindow); });
            // marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
        });
        localSearch.search(keyword);
    }
</script>
</body>
</html>
